#include<bits/stdc++.h>
using namespace std;
#define int long long

double pc[1000005];
double preMax[1000005];

signed main() {
	int n;
	double p, a, b, c, d;
	cin >> p >> a >> b >> c >> d >> n;
	for (int i = 1; i <= n; i++) {
		pc[i] = p * (sin(a * i + b) + cos(c * i + d) + 2);
	}

	double ans = -1;
	for (int i = 2; i <= n; i++) {
		preMax[i] = max(pc[i - 1], preMax[i - 1]);
		ans = max(preMax[i] - pc[i], ans);
	}
	if (ans > 0)
		cout << fixed << setprecision(7) << ans;
	else
		cout << "0.00";
	return 0;
}
